<?php

namespace app\cms\validate;

use app\common\validate\BaseValidate;

class Express   extends BaseValidate
{
    protected $rule = [
        'tracking_number' => 'require|length:10,20|alphaNum',
        'id'       => 'require|number|gt:0',
        'user_id'  => 'require|number|gt:0',
        'status'   => 'require|in:3,4,5,6' // 1=已入库 2=已预约 3=配货中 4=已出库 5=已送达 6已签收
    ];

    protected $message = [
        'tracking_number.require' => '快递单号不能为空',
        'tracking_number.length'  => '单号长度10-20位',
        'tracking_number.alphaNum'=> '单号只能包含字母和数字',
        'id.require'      => '快递必须为大于0的整数',
        'user_id.gt'      => '非法用户',
        'status.in'       => '状态值非法'
    ];

    protected $scene = [
        'create' => ['tracking_number'],
        'update' => ['id', 'status'], //修改快递状态
    ];
}